/*for workpage.vue*/
import pageContRight from '../../src/components/pageModule/pageContRight'

export default {
	name: 'workpage',
	components: {
		pageContRight
	},
	data: function (){
		return {
			artItemData: [],
			artItemDatas: '',//存放模拟的动态数据
			spinShow: true
		}
	},
	mounted(){
		this.$ajax.get("https://www.easy-mock.com/mock/5a93ac92bf782667fe4c7a32/followTest/artLists").then(response => {
			// success callback
			this.artItemDatas = response.data.data.datas ////获取模拟的动态数据
			this.artItemData = response.data.data.datas
			this.spinShow = false //数据加载成功之后处理掉加载层的遮罩
		}, response => {
			// error callback
			alert('数据加载失败...')
		})
	},
	methods: {
		workClassLisClick: function (name){//模拟动态数据
			this.artItemData = []
			if(name == 'all'){
				this.artItemData = this.artItemDatas
			}else if(name == 'html'){
				this.artItemData.push(this.artItemDatas[0])
			}else if(name == 'css'){
				this.artItemData.push(this.artItemDatas[1])
				this.artItemData.push(this.artItemDatas[5])
			}else if(name == 'jq'){
				this.artItemData.push(this.artItemDatas[2])
				this.artItemData.push(this.artItemDatas[6])
			}else if(name == 'node'){
				this.artItemData.push(this.artItemDatas[3])
				this.artItemData.push(this.artItemDatas[7])
			}else if(name == 'vue'){
				this.artItemData.push(this.artItemDatas[4])
			}
		},
		showArtDetail: function (id){//点击获取文章详情
			window.location.href = '/home/workpage/articleDetails?id='+id;
		}
	}
}